var express = require('express');
var router = express.Router();
var db = require('../config/db');

/* GET home page. */

router.get('/test-redis-get', function(req, res, next) {
  db.redis.get('testkey', function(err, data) {
    res.send(data);
  });
});

router.get('/test-neo4j-create', function(req, res, next) {
  db.neo4j.cypher({
    query: 'CREATE (k:Knowledge { name: {name}, owner: {owner}}) RETURN k',
    params: {
      name: 'Computer Science',
      owner: 'System'
    }
  }, function(err, results) {
    res.send(results);
  });
});

router.get('/test-neo4j-get', function(req, res, next) {
  db.neo4j.cypher({
    query: 'MATCH (knowledge:Knowledge) WHERE knowledge.name = {name} RETURN knowledge;',
    params: {
      name: 'Computer Science'
    }
  }, function(err, results) {
    res.send(results);
  });
});

router.use('/', function(req, res, next) {
  res.render('index', { title: 'Express' });
});


module.exports = router;
